﻿using System.Windows;
using System.Windows.Controls;
using System.Windows.Threading;
using Infrastructure.Helpers;
using Infrastructure.ViewModels;
using Microsoft.Practices.Composite.Events;

namespace DocumentDetailsModule.Views
{
    /// <summary>
    /// Interaction logic for DocumentDetailsView.xaml
    /// </summary>
    public partial class DocumentDetailsView : UserControl, IDocumentDetailsView
    {
        readonly IEventAggregator _eventAggregator;
        private readonly DependencyObject _detailsPage;
        readonly Dispatcher _dispatcher;
        public new Dispatcher Dispatcher
        {
            get
            {
                return _dispatcher;
            }
        }

        public CatalogItemViewModel Model
        {
            get
            {
                return DataContext as CatalogItemViewModel;
            }
            set
            {
                DataContext = value;
            }
        }

        public DocumentDetailsView(IEventAggregator eventAggregator)
        {
            
            InitializeComponent();

            _eventAggregator = eventAggregator;
            _dispatcher = Dispatcher.CurrentDispatcher;

            _detailsPage = XamlHelper.Load("Xaml/CatalogItemInformation.xaml");
            Content = _detailsPage;
        }
    }
}
